package it.low.game.core.location;

import it.low.game.core.element.activity.Targetable;

import java.awt.Point;

public class MapPoint extends Point implements Targetable {

	private double mapPointX = 0;
	private double mapPointY = 0;
	
	public MapPoint(int x, int y){
		super(x,y);
		this.mapPointX = x;
		this.mapPointY = y;
	}
	
	public MapPoint(double mapPointX, double mapPointY){
		super((int)mapPointX, (int)mapPointY);
		this.mapPointX = mapPointX;
		this.mapPointY = mapPointY;
	}
	
	public double getX(){
		return this.mapPointX;
	}
	
	public void setMapPointX(double mapPointX){
		this.mapPointX = mapPointX;
		this.x = (int)mapPointX;
	}
	
	public double getY(){
		return this.mapPointY;
	}
	
	public void setMapPointY(double mapPointY){
		this.mapPointY = mapPointY;
		this.y = (int)mapPointY;
	}
	
	public void setLocation(double mapPointX, double mapPointY){
		super.setLocation(mapPointX,mapPointY);
		this.mapPointX = mapPointX;
		this.mapPointY = mapPointY;
	}
	
	public boolean isNear(MapPoint mapPoint, double maxDist){
		double distance = this.distance(mapPoint);
		return distance<=maxDist;
	}
	
	public MapPoint getMapPosition(){
		return this;
	}
	
	public void setMapPosition(MapPoint mapPoint){
		setLocation(mapPoint);
	}
	
	
}
